#!/bin/bash

#init kuelete
sudo kubeadm init --config kubeadm-config.yaml

#make kubectl available to non-root users
mkdir -p $HOME/.kube
sudo cp -f /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

#scheduling pod on the control plane node
kubectl taint nodes --all node-role.kubernetes.io/control-plane-

#add kata runtime
cat <<-EOF | kubectl apply -f -
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
  name: kata
handler: kata
EOF
